import axios from '@/libs/api.request.js'

export const findAll = () => {
    return axios.request({
        method:'get',
        data:null,
        url:`role/findAll`
    });
};


export const getRoleList = data => {
    return axios.request({
        url:`role/getRoleList`,
        method:'post',
        data:data
    });
};

export const saveRole = data => {
    return axios.request({
        method:"post",
        url:`role/saveRole`,
        data:data
    });
};

export const updateRole = data => {
    return axios.request({
        method:"post",
        url:`role/updateRole`,
        data:data
    });
};

export const saveOrUpdateRole = data => {
    return data.id ? updateRole(data) : saveRole(data);
};

export const removeRole = data => {
    return axios.request({
        method:'get',
        data:null,
        url:`role/removeRole/${data.id}`
    });
};

export const saveOrUpdateUserRole = data => {
    return axios.request({
        method:"post",
        url:`role/saveOrUpdateUserRole`,
        data:data
    });
};